package com.cn.dao;

import java.util.ArrayList;
import java.util.List;

import com.cn.entity.DepartmentDetail;

/**
 * 科类详细信息操作
 * @author Administrator
 *
 */
public class DepartmentDetailDao extends BaseDao {
	private DepartmentDetail dmDetail=null;
	/**
	 * 查询科类详细信息
	 * @param id 查询科目id
	 * @return 返回科类详细对象
	 */
	public DepartmentDetail findDmDetail(int id) {
		dmDetail = new DepartmentDetail();
		con = this.getCon();
		String sql ="select * from department_detail where did="+id;
		try {
			psta = con.prepareStatement(sql);
			rst = psta.executeQuery();
			while (rst.next()) {
				dmDetail.setId(rst.getInt("id"));
				dmDetail.setTag(rst.getString("tag"));
				dmDetail.setDid(rst.getInt("did"));
				dmDetail.setTitle(rst.getString("title"));
				dmDetail.setUptime(rst.getInt("uptime"));
				dmDetail.setHits(rst.getInt("hits"));
				dmDetail.setContent(rst.getString("content"));
				dmDetail.setSource(rst.getString("source"));
				dmDetail.setRustic(rst.getInt("rustic"));
				dmDetail.setPraise(rst.getInt("praise"));
				dmDetail.setImgmode(rst.getInt("imgmode"));
				dmDetail.setVideo_pic(rst.getString("video_pic"));
				dmDetail.setVideo_url(rst.getString("video_url"));
				dmDetail.setList(rst.getString("list"));
				dmDetail.setReviews(rst.getString("reviews"));
			}
		} catch (Exception e) {
			e.printStackTrace();
		}finally{
			this.closeAll();
		}
		return dmDetail;
	}
	//测试
	public static void main(String[] args) {
		DepartmentDetailDao dao = new DepartmentDetailDao();
		DepartmentDetail dmDetail = dao.findDmDetail(3569);
		System.out.println(dmDetail.getContent());
	}
}
